/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';

import {
    AppRegistry,
    Animated,
    View,
    StyleSheet,
    Text,
} from 'react-native';

var MHList = require('./classes/main.js');
var Found = require('./classes/Found.js');
const Invest = require('./classes/Invest.js');

import TabNavigator from 'react-native-tab-navigator';

import { NativeModules } from 'react-native';
import { NativeAppEventEmitter } from 'react-native';
var subscription;

var Calendaer = NativeModules.OriginalModule;


var count = 3;

var ListDemo = React.createClass({

    getInitialState() {
        return {
            selectedTab:'home'
        }
    },

    render() {
        return (
            <View style={homeStyle.containerStyle}>
                <TabNavigator
                    hidesTabTouch={true}>
                    <TabNavigator.Item
                        title="首页"
                        selected={this.state.selectedTab === 'home'}
                        onPress={() => this.setState({ selectedTab: 'home' })}
                    >
                        <MHList></MHList>
                    </TabNavigator.Item>

                    <TabNavigator.Item
                        title="投资"
                        selected={this.state.selectedTab === 'found'}
                        onPress={() => this.setState({ selectedTab: 'found' })}
                    >
                        <Invest></Invest>
                    </TabNavigator.Item>

                    <TabNavigator.Item
                        title="发现"
                        selected={this.state.selectedTab === 'invest'}
                        onPress={() => this.setState({ selectedTab: 'invest' })}
                    >
                        <Found></Found>
                    </TabNavigator.Item>

                </TabNavigator>
            </View>

        );
    },

    componentDidMount() {
        // Calendaer.addEvent('Birthday Party', '4 Privet Drive, Surrey');
    }
});


var homeStyle = StyleSheet.create({
    containerStyle: {
        flex: 1,
    }

});

var SecView = require('./SecondView');
var SecondView = React.createClass({
    render() {
        return (
            <SecView></SecView>
        )
    }
})


AppRegistry.registerComponent('ListDemo', () => ListDemo);
AppRegistry.registerComponent('SecondView', () => SecondView);